feat(usb): tier-1 fbuild-core::usb resolver + online-data branch wiring#712
Conversation
- Add `usb-ids` crate as tier-1 bundled VID:PID -> {vendor, product}
resolver in `fbuild_core::usb`. Tier-2 reads an optional JSON overlay
installed by the daemon at startup. Tier-3 returns a synthetic
`"Unknown vendor 0xVVVV"` placeholder so callers never see None.
- Wire the resolver into the daemon's device enumeration so device
descriptions, `/api/devices/list`, and `/api/devices/{port}/status`
carry pretty vendor/product names. CLI `device list` / `device status`
print `"vendor product (VVVV:PPPP)"`; deploy port selection logs the
same canonical string at connect time.
- Add `.github/workflows/nightly-usb-ids.yml` that refreshes the orphan
`online-data` branch daily. The workflow YAML lives on `main` (required
for `schedule` / `workflow_dispatch`); the merger script + data files
live on `online-data` only. Fault-tolerant against any single source
failure; refuses to write a too-small dataset; prunes history to 200.
- Add `crates/fbuild-core/examples/dump_usb_ids.rs` as the tier-1 dump
source for the nightly workflow (kept as an example so no new crate
is introduced — see `ci/hooks/crate_guard.py`).
- New `ci/hooks/crate_guard.py` PreToolUse hook blocks Edit/Write of any
`Cargo.toml` outside the approved set, enforcing the monocrate policy
in real time. Remove the per-edit lint hook from PostToolUse — it was
triggering a full `clippy --all-targets` recompile on every save; the
Stop hook still gates everything on session end.
- Document the full design in `docs/online-data.md` and `tasks/todo.md`.
Goal acceptance:
fbuild-core: 9 new usb tests pass
fbuild-daemon: 178/178 tests pass
workspace `cargo check` clean
|
Warning Review limit reached
More reviews will be available in 27 minutes and 46 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (23)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…llow-up) (#713) Two changes to .claude/settings.json: 1. Removed the project-local `tool_guard.py` PreToolUse hook — the user confirmed they install soldr/uv guards globally, so the duplicate fires twice without value. `forbidden_commands.py` (pyocd/esptool policy) stays as the project-specific Bash gate. 2. Every hook command is now wedge-proof: - Prefer `${CLAUDE_PROJECT_DIR}` (the harness anchor that survives worktree shifts) and fall back to `git rev-parse --show-toplevel`. - Wrap the actual `uv run` invocation in `[ -f <script> ] && ... || exit 0` so a worktree without `ci/hooks/` (e.g. the `online-data` orphan branch's worktree, or a freshly-orphaned branch mid-setup) cannot fail the hook startup and freeze the shell. This was the catch-22 that wedged the original `online-data` orphan setup in PR #712: `git rm -rf .` removed `ci/hooks/` from the worktree; the PreToolUse hook command then resolved `git rev-parse --show-toplevel` to that worktree, tried `uv run ci/hooks/tool_guard.py`, and python errored with "no such file" — blocking every subsequent Bash/Edit/Write call. The guard above turns the "script not found" case into a no-op instead of a block. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Summary
fbuild_core::usbmodule: three-tier USB VID:PID → vendor/product name resolver.usb-idscrate (~20,480 entries,phfperfect hash, zero IO).{ "VVVV:PPPP": {vendor, product} }JSON overlay loaded from a daemon-managed cache file; tracks the newonline-dataorphan branch in this repo."Unknown vendor 0xVVVV"fallback —resolve()never returnsNone.pretty(vid, pid)is the canonical"vendor product (VVVV:PPPP)"display string./api/devices/list,/api/devices/{port}/status, the CLI'sdevice list/device status, and the deploy port selection log all carry the resolved name everywhere a port is mentioned.crates/fbuild-core/examples/dump_usb_ids.rs(an example, not a new crate — monocrate policy preserved) dumps the bundled DB as JSON. Used by the nightly workflow as the tier-1 input source..github/workflows/nightly-usb-ids.ymlrefreshes the orphanonline-databranch daily + on-demand (workflow_dispatch). Fault-tolerant against any single source failure; refuses to overwrite a healthy committed dataset with too-small output; prunes history to the most recent 200 commits.ci/hooks/crate_guard.pyPreToolUse hook blocks Edit/Write of anyCargo.tomloutside the approved set — real-time monocrate enforcement, complementing the batch CI check.cargo clippy --all-targetson every save). The Stop hook still gates everything on session end..claude/settings.jsonare now wedge-proof: they prefer\$CLAUDE_PROJECT_DIR(the harness anchor that survives worktree shifts) and[ -f <script> ]so an orphan-branch worktree withoutci/hooks/no longer freezes the shell.docs/online-data.mdandtasks/todo.md.Companion artifacts
Test plan
🤖 Generated with Claude Code